import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { render } from "/@/utils/common/renderUtils";

// 定义可选择的组件类型
export enum ComponentTypes {
  Default = 'layouts/default/index',
  IFrame = 'sys/iframe/FrameBlank',
}

export const columns: BasicColumn[] = [
  {
    title: '规格名称',
    dataIndex: 'name',
    width: 160
  },
  {
    title: '可选类型',
    dataIndex: 'selectType',
    customRender: ({text}) => {
      return render.renderDict(text, 'spec_select_type')
    },
    width: 64,
  },
  {
    title: '规格值',
    dataIndex: 'valueData',
    customRender: ({text}) => {
      return render.renderTag(text.split(','), 'green')
    },
    width: 200,
  },
  {
    title: '排序',
    dataIndex: 'sortNo',
    width: 50,
  }
];


export const formSchema: FormSchema[] = [
  {
    label: 'id',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    field: 'name',
    label: '规格名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'valueData',
    label: '规格值',
    required: true,
    component: 'Select',
    componentProps: {
      mode: 'tags',
      maxTagTextLength: 100
    }
  },

  {
    field: 'selectType',
    label: '选择类型',
    required: true,
    defaultValue: '1',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'spec_select_type',
      type:'radio',
    }
  },

  {
    field: 'handAddStatus',
    label: '支持手动新增',
    required: true,
    defaultValue: '1',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'bool_value',
      type:'radio',
    }
  },

  {
    field: 'sortNo',
    label: '排序',
    component: 'InputNumber',
    defaultValue: 1,
    componentProps: {
      size: 'middle',
      style: {
        width: '100%'
      }
    }
  },

 
];
